package com.ruoyi.web.controller.cat;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.cat.domain.AdTicketClassify1;
import com.ruoyi.cat.service.IAdTicketClassify1Service;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 分类 大类Controller
 * 
 * @author ruoyi
 * @date 2025-07-16
 */
@RestController
@RequestMapping("/system/ticketClassify1")
public class AdTicketClassify1Controller extends BaseController
{
    @Autowired
    private IAdTicketClassify1Service adTicketClassify1Service;

    /**
     * 查询分类 大类列表
     */
    @PreAuthorize("@ss.hasPermi('system:classify1:list')")
    @GetMapping("/list")
    public TableDataInfo list(AdTicketClassify1 adTicketClassify1)
    {
        startPage();
        List<AdTicketClassify1> list = adTicketClassify1Service.selectAdTicketClassify1List(adTicketClassify1);
        return getDataTable(list);
    }

    /**
     * 导出分类 大类列表
     */
    @PreAuthorize("@ss.hasPermi('system:classify1:export')")
    @Log(title = "分类 大类", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AdTicketClassify1 adTicketClassify1)
    {
        List<AdTicketClassify1> list = adTicketClassify1Service.selectAdTicketClassify1List(adTicketClassify1);
        ExcelUtil<AdTicketClassify1> util = new ExcelUtil<AdTicketClassify1>(AdTicketClassify1.class);
        util.exportExcel(response, list, "分类 大类数据");
    }

    /**
     * 获取分类 大类详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:classify1:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(adTicketClassify1Service.selectAdTicketClassify1ById(id));
    }

    /**
     * 新增分类 大类
     */
    @PreAuthorize("@ss.hasPermi('system:classify1:add')")
    @Log(title = "分类 大类", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AdTicketClassify1 adTicketClassify1)
    {
        return toAjax(adTicketClassify1Service.insertAdTicketClassify1(adTicketClassify1));
    }

    /**
     * 修改分类 大类
     */
    @PreAuthorize("@ss.hasPermi('system:classify1:edit')")
    @Log(title = "分类 大类", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AdTicketClassify1 adTicketClassify1)
    {
        return toAjax(adTicketClassify1Service.updateAdTicketClassify1(adTicketClassify1));
    }

    /**
     * 删除分类 大类
     */
    @PreAuthorize("@ss.hasPermi('system:classify1:remove')")
    @Log(title = "分类 大类", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(adTicketClassify1Service.deleteAdTicketClassify1ByIds(ids));
    }
}
